<?php
require "util/DBUtil.php";
$db = new DBUtil();
$titles = array("新品书籍","读者推荐","独家提供","精选好书");
$sql = "select * from book where typeNo=? limit 4";
$pram = array("1","2","3","4");
?>
<div class="container">
<?php
    for($i=0;$i<count($titles);$i++){
        ?>
    <div class="row">
        <div style="border-bottom: 1px solid #ddd;margin-bottom: 10px">
            <h3><?php echo $titles[$i];?></h3>
        </div>

    </div>
    <div class="row">
        <?php
        $resultSet = $db->query($sql,$pram[$i]);
        ?>

        <?php
        foreach ($resultSet as $result) {
            ?>
            <a href="page/details.php?bookNo=<?php echo $result[bookNo] ?>"  target="_blank">
                <div class="col-md-3">
                    <div class="thumbnail">
                        <img src=<?php echo 'img/' . $result[picture] ?> alt=<?php echo $result[bookName] ?>
                             class="img-responsive center-block"
                             width="360" title=<?php echo $result[bookName] ?> >
                        <div class="caption">
                            <p><?php echo $result[bookName] ?></p>
                            <h3 style="color: #f42424">&yen;<?php echo $result[price] ?></h3>
                        </div>
                    </div>
                </div>
            </a>
            <?php
        }
        ?>
    </div>
        <?php
    }
    $db->close();
?>
</div>
